<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="placeholder.js"></script>

<body>
  <div style="height:10000px;"></div>
</body>

<script>
  async_test(function(t) {
    const img = new Image();
    img.onload = t.step_func_done(function() {
      assert_true(is_image_fully_loaded(img));
    });
    img.src = '../loading/resources/base-image1.png';
  }, "Test that load event is fired for JS Image() fetches");

  async_test(function(t) {
    const attached_img = document.createElement("IMG");
    document.body.appendChild(attached_img);
    attached_img.onload = t.step_func_done(function() {
      assert_true(is_image_fully_loaded(attached_img));
    });
    attached_img.src = "../loading/resources/base-image2.png";
  }, "Test that load event is fired for <img> created via JS and attached below viewport");
</script>
